//
//  WebViewController.m
//  QiongYou
//
//  Created by 操道涛 on 15/12/22.
//  Copyright © 2015年 操道涛. All rights reserved.
//

#import "WebViewController.h"
#import "MBProgressHUD+MJ.h"
@interface WebViewController ()
{
    NSInteger imageTag;
    NSURL *url;
}
@end

@implementation WebViewController
@synthesize imgTag=imageTag;
- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"%ld",(long)imageTag);
    [self.view setBackgroundColor:[UIColor whiteColor]];
    self.navigationController.navigationBarHidden=NO;
    self.navigationController.navigationBar.backgroundColor=[UIColor whiteColor];
    UIButton *leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(10, 20, 10, 20)];
    [leftBtn setImage:[UIImage imageNamed:@"gengdup"] forState:UIControlStateNormal];
    [leftBtn addTarget:self action:@selector(leftBarButtonclick) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftBtn];
    UIWebView *webview=[[UIWebView alloc]initWithFrame:CGRectMake(0,0, ScreenWidth, ScreenHeight)];
    [MBProgressHUD showHUDAddedTo:[UIApplication sharedApplication].keyWindow animated:YES];
    webview.scalesPageToFit=YES;
    [self.view addSubview:webview];
    if (imageTag) {
        switch (imageTag) {
            case 1:
                url=[NSURL URLWithString:@"http://m.qyer.com/z/zt/islandisland&source=app&campaign=appshouye&category=ht1-islandisland/?source=app&client_id=qyer_ios&track_user_id=&track_deviceid=94600906-5BB7-43E7-9E16-C479A03EE469&track_app_version=6.3%2522"];
                break;
            case 2:
                url=[NSURL URLWithString:@"http://m.qyer.com/z/zt/chiangmai2&source=app&campaign=appshouye&category=ht2-chiangmai2/?source=app&client_id=qyer_ios&track_user_id=&track_deviceid=94600906-5BB7-43E7-9E16-C479A03EE469&track_app_version=6.3"];
                break;
            case 3:
                url=[NSURL URLWithString:@"http://m.qyer.com/z/zt/unitedkingdom&source=app&campaign=appshouye&category=ht3-unitedkingdom/?source=app&client_id=qyer_ios&track_user_id=&track_deviceid=94600906-5BB7-43E7-9E16-C479A03EE469&track_app_version=6.3"];
                break;
            case 4:
                url=[NSURL URLWithString:@"http://appview.qyer.com/bbs/thread-1422134-1.html?campaign=appshouye&category=ht5-luqian&source=app&client_id=qyer_ios&track_user_id=&track_deviceid=94600906-5BB7-43E7-9E16-C479A03EE469&track_app_version=6.3"];
                break;
            case 5:
                url=[NSURL URLWithString:@"http://appview.qyer.com/bbs/thread-1419061-1.html?campaign=appshouye&category=ht5-1419061&source=app&client_id=qyer_ios&track_user_id=&track_deviceid=94600906-5BB7-43E7-9E16-C479A03EE469&track_app_version=6.3"];
                break;
            case 6:
                url=[NSURL URLWithString:@"http://appview.qyer.com/bbs/thread-1403346-1.html?campaign=appshouye&category=ht6-1403346&source=app&client_id=qyer_ios&track_user_id=&track_deviceid=94600906-5BB7-43E7-9E16-C479A03EE469&track_app_version=6.3"];
                break;
                
            default:
                break;
        }

    }else if (self.Section0cellimg1Tag){
    
        url=[NSURL URLWithString:@"http://appview.qyer.com/op/zt/20150616.html"];
    }else if (self.Section0cellimg2Tag){
        url=[NSURL URLWithString:@"http://appview.qyer.com/op/zt/20150619.html"];
    }else if (self.Section1cellimg1Tag){
        url=[NSURL URLWithString:@"http://appview.qyer.com/op/zt/20150616.html"];
        
    }else if (self.Section1cellimg2Tag){
        url=[NSURL URLWithString:@"http://appview.qyer.com/op/zt/20150619.html"];
    }else if (self.Section1cellimg3Tag){
        url=[NSURL URLWithString:@"http://appview.qyer.com/bbs/thread-1314402-1.html?campaign=appshouye&category=ht2-1314402"];
    }else if (self.Section2cellimgTag){
        url=[NSURL URLWithString:@"http://appview.qyer.com/op/zt/20150616.html"];

    }
    
    NSURLRequest *request=[NSURLRequest requestWithURL:url];
    [webview loadRequest:request];
    
    [MBProgressHUD hideAllHUDsForView:[UIApplication sharedApplication].keyWindow animated:YES];
}
- (void)leftBarButtonclick{
    self.navigationController.navigationBarHidden=YES;
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
